export default {
  data() {
    const checkPhones = (rule, value, callback) => {
      if (value) {
        if (this.regCheck('fmPhone', value))
        return callback(new Error("请填写正确的联系方式"));
      }
      callback();
    };
    return {
      ruleForm: {
        buildingName: "",
        buildingType: "",
        address: "",
        contactsPerson: "",
        contactsPhone: "",
        files: "",
      },
      rules: {
        buildingName: [
          { required: true, message: "请输入楼宇名称", trigger: "blur" },
        ],
        buildingType: [
          { required: true, message: "请选择楼宇类型", trigger: "change" },
        ],
        address: [
          { required: true, message: "请输入楼宇所在详细位置", trigger: "change" },
        ],
        contactsPerson: [
          { required: true, message: "请输入联系人姓名", trigger: "blur" },
        ],
        contactsPhone: [
          { required: true, message: "请输入联系方式", trigger: "blur" },
          { validator: checkPhones, trigger: "blur" },
        ],
        files: [
          { required: true, message: "请上传文件", trigger: "blur" }
        ]
      }
    }
  }
}